package homework.day01;

import java.io.File;
import java.io.IOException;
import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        while(true){
            System.out.println("请输入新建的文件名：");
            String name = sc.nextLine();
            File file = new File(name);
            if(file.exists()){
                System.out.println("该文件已存在");
            }else{
                file.createNewFile();
                System.out.println("文件已创建");
                System.exit(0);
            }
        }
    }
}
